package com.kazalan.domain.document;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import com.kazalan.domain.BaseObject;

public class Section extends BaseObject implements Serializable {

	private static final long serialVersionUID = -7845847642109829003L;

	private String sectionNumber;

	private int order;

	private Section parent;

	private Document document;

	private String name;

	private String text;

	private List<Section> sections;

	public Section() {
		super();
		setSections(new LinkedList<Section>());
	}

	public String getSectionNumber() {
		return sectionNumber;
	}

	public void setSectionNumber(String sectionNumber) {
		this.sectionNumber = sectionNumber;
	}

	public int getOrder() {
		return order;
	}

	public void setOrder(int order) {
		this.order = order;
	}

	public Section getParent() {
		return parent;
	}

	public void setParent(Section parent) {
		this.parent = parent;
	}

	public void setDocument(Document document) {
		this.document = document;
	}

	public Document getDocument() {
		return document;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getText() {
		return text;
	}

	public void addSection(Section section) {
		this.sections.add(section);
	}

	public void setSections(List<Section> sections) {
		this.sections = sections;
	}

	public List<Section> getSections() {
		return sections;
	}

	@Override
	public String toString() {

		return new StringBuilder().append(this.sectionNumber + " ")
				.append(this.order + " ")
				.append(this.getId() + " " + this.name).append(" " + sections)
				.toString();

	}

}
